<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en"><head><title>Draft: PubSubHubbub Core 0.3 -- Working Draft</title>
<meta http-equiv="Expires" content="Tue, 09 Feb 2010 05:18:45 +0000">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="description" content="PubSubHubbub Core 0.3 -- Working Draft">
<meta name="generator" content="xml2rfc v1.33 (http://xml.resource.org/)">
<style type='text/css'><!--
        body {
                font-family: verdana, charcoal, helvetica, arial, sans-serif;
                font-size: small; color: #000; background-color: #FFF;
                margin: 2em;
        }
        h1, h2, h3, h4, h5, h6 {
                font-family: helvetica, monaco, "MS Sans Serif", arial, sans-serif;
                font-weight: bold; font-style: normal;
        }
        h1 { color: #900; background-color: transparent; text-align: right; }
        h3 { color: #333; background-color: transparent; }

        td.RFCbug {
                font-size: x-small; text-decoration: none;
                width: 30px; height: 30px; padding-top: 2px;
                text-align: justify; vertical-align: middle;
                background-color: #000;
        }
        td.RFCbug span.RFC {
                font-family: monaco, charcoal, geneva, "MS Sans Serif", helvetica, verdana, sans-serif;
                font-weight: bold; color: #666;
        }
        td.RFCbug span.hotText {
                font-family: charcoal, monaco, geneva, "MS Sans Serif", helvetica, verdana, sans-serif;
                font-weight: normal; text-align: center; color: #FFF;
        }

        table.TOCbug { width: 30px; height: 15px; }
        td.TOCbug {
                text-align: center; width: 30px; height: 15px;
                color: #FFF; background-color: #900;
        }
        td.TOCbug a {
                font-family: monaco, charcoal, geneva, "MS Sans Serif", helvetica, sans-serif;
                font-weight: bold; font-size: x-small; text-decoration: none;
                color: #FFF; background-color: transparent;
        }

        td.header {
                font-family: arial, helvetica, sans-serif; font-size: x-small;
                vertical-align: top; width: 33%;
                color: #FFF; background-color: #666;
        }
        td.author { font-weight: bold; font-size: x-small; margin-left: 4em; }
        td.author-text { font-size: x-small; }

        /* info code from SantaKlauss at http://www.madaboutstyle.com/tooltip2.html */
        a.info {
                /* This is the key. */
                position: relative;
                z-index: 24;
                text-decoration: none;
        }
        a.info:hover {
                z-index: 25;
                color: #FFF; background-color: #900;
        }
        a.info span { display: none; }
        a.info:hover span.info {
                /* The span will display just on :hover state. */
                display: block;
                position: absolute;
                font-size: smaller;
                top: 2em; left: -5em; width: 15em;
                padding: 2px; border: 1px solid #333;
                color: #900; background-color: #EEE;
                text-align: left;
        }

        a { font-weight: bold; }
        a:link    { color: #900; background-color: transparent; }
        a:visited { color: #633; background-color: transparent; }
        a:active  { color: #633; background-color: transparent; }

        p { margin-left: 2em; margin-right: 2em; }
        p.copyright { font-size: x-small; }
        p.toc { font-size: small; font-weight: bold; margin-left: 3em; }
        table.toc { margin: 0 0 0 3em; padding: 0; border: 0; vertical-align: text-top; }
        td.toc { font-size: small; font-weight: bold; vertical-align: text-top; }

        ol.text { margin-left: 2em; margin-right: 2em; }
        ul.text { margin-left: 2em; margin-right: 2em; }
        li      { margin-left: 3em; }

        /* RFC-2629 <spanx>s and <artwork>s. */
        em     { font-style: italic; }
        strong { font-weight: bold; }
        dfn    { font-weight: bold; font-style: normal; }
        cite   { font-weight: normal; font-style: normal; }
        tt     { color: #036; }
        tt, pre, pre dfn, pre em, pre cite, pre span {
                font-family: "Courier New", Courier, monospace; font-size: small;
        }
        pre {
                text-align: left; padding: 4px;
                color: #000; background-color: #CCC;
        }
        pre dfn  { color: #900; }
        pre em   { color: #66F; background-color: #FFC; font-weight: normal; }
        pre .key { color: #33C; font-weight: bold; }
        pre .id  { color: #900; }
        pre .str { color: #000; background-color: #CFF; }
        pre .val { color: #066; }
        pre .rep { color: #909; }
        pre .oth { color: #000; background-color: #FCF; }
        pre .err { background-color: #FCC; }

        /* RFC-2629 <texttable>s. */
        table.all, table.full, table.headers, table.none {
                font-size: small; text-align: center; border-width: 2px;
                vertical-align: top; border-collapse: collapse;
        }
        table.all, table.full { border-style: solid; border-color: black; }
        table.headers, table.none { border-style: none; }
        th {
                font-weight: bold; border-color: black;
                border-width: 2px 2px 3px 2px;
        }
        table.all th, table.full th { border-style: solid; }
        table.headers th { border-style: none none solid none; }
        table.none th { border-style: none; }
        table.all td {
                border-style: solid; border-color: #333;
                border-width: 1px 2px;
        }
        table.full td, table.headers td, table.none td { border-style: none; }

        hr { height: 1px; }
        hr.insert {
                width: 80%; border-style: none; border-width: 0;
                color: #CCC; background-color: #CCC;
        }
--></style>
</head>
<body>
<table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc">&nbsp;TOC&nbsp;</a></td></tr></table>
<table summary="layout" width="66%" border="0" cellpadding="0" cellspacing="0"><tr><td><table summary="layout" width="100%" border="0" cellpadding="2" cellspacing="1">
<tr><td class="header">Draft</td><td class="header">B. Fitzpatrick</td></tr>
<tr><td class="header">&nbsp;</td><td class="header">B. Slatkin</td></tr>
<tr><td class="header">&nbsp;</td><td class="header">Google, Inc</td></tr>
<tr><td class="header">&nbsp;</td><td class="header">M. Atkins</td></tr>
<tr><td class="header">&nbsp;</td><td class="header">Six Apart Ltd.</td></tr>
<tr><td class="header">&nbsp;</td><td class="header">February 8, 2010</td></tr>
</table></td></tr></table>
<h1><br />PubSubHubbub Core 0.3 -- Working Draft</h1>

<h3>Abstract</h3>

<p>An open, simple, web-scale pubsub protocol, along with an open source
      reference implentation targetting Google App Engine. Notably, however,
      nothing in the protocol is centralized, or Google- or App
      Engine-specific. Anybody can play.
</p>
<p>As opposed to more developed (and more complex) pubsub specs like <a class='info' href='#XEP-0060'>Jabber Publish-Subscribe<span> (</span><span class='info'>Millard, P., Saint-Andre, P., and R. Meijer, &ldquo;Publish-Subscribe,&rdquo; .</span><span>)</span></a> [XEP&#8209;0060] this spec's base profile
      (the barrier-to-entry to speak it) is dead simple. The fancy bits required
      for high-volume publishers and subscribers are optional. The base profile
      is HTTP-based, as opposed to XMPP (see more on this below).
</p>
<p>To dramatically simplify this spec in several places where we had to
      choose between supporting A or B, we took it upon ourselves to say "only
      A", rather than making it an implementation decision.
</p>
<p>We offer this spec in hopes that it fills a need or at least advances
      the state of the discussion in the pubsub space. Polling sucks. We think
      a decentralized pubsub layer is a fundamental, missing layer in the
      Internet architecture today and its existence, more than just enabling
      the obvious lower latency feed readers, would enable many cool
      applications, most of which we can't even imagine. But we're looking
      forward to decentralized social networking.
</p><a name="toc"></a><br /><hr />
<h3>Table of Contents</h3>
<p class="toc">
<a href="#anchor1">1.</a>&nbsp;
Notation and Conventions<br />
<a href="#anchor2">2.</a>&nbsp;
Definitions<br />
<a href="#anchor3">3.</a>&nbsp;
High-level protocol flow<br />
<a href="#anchor4">4.</a>&nbsp;
Atom Details<br />
<a href="#discovery">5.</a>&nbsp;
Discovery<br />
<a href="#subscribing">6.</a>&nbsp;
Subscribing and Unsubscribing<br />
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#anchor5">6.1.</a>&nbsp;
Subscriber Sends Subscription Request<br />
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#verifysub">6.2.</a>&nbsp;
Hub Verifies Intent of the Subscriber<br />
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#autorefresh">6.3.</a>&nbsp;
Automatic Subscription Refreshing<br />
<a href="#publishing">7.</a>&nbsp;
Publishing<br />
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#anchor9">7.1.</a>&nbsp;
New Content Notification<br />
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#contentfetch">7.2.</a>&nbsp;
Content Fetch<br />
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#contentdistribution">7.3.</a>&nbsp;
Content Distribution<br />
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#authednotify">7.4.</a>&nbsp;
Authenticated Content Distribution<br />
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#aggregatedistribution">7.5.</a>&nbsp;
Aggregated Content Distribution<br />
<a href="#bestpractices">8.</a>&nbsp;
Best Practices<br />
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#hubbestpractices">8.1.</a>&nbsp;
For Hubs<br />
&nbsp;&nbsp;&nbsp;&nbsp;<a href="#subbestpractices">8.2.</a>&nbsp;
For Subscribers<br />
<a href="#rfc.references1">9.</a>&nbsp;
References<br />
<a href="#anchor11">Appendix&nbsp;A.</a>&nbsp;
Specification Feedback<br />
<a href="#rfc.authors">&#167;</a>&nbsp;
Authors' Addresses<br />
</p>
<br clear="all" />

<a name="anchor1"></a><br /><hr />
<table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc">&nbsp;TOC&nbsp;</a></td></tr></table>
<a name="rfc.section.1"></a><h3>1.&nbsp;
Notation and Conventions</h3>

<p>The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
      "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
      document are to be interpreted as described in <a class='info' href='#RFC2119'>[RFC2119]<span> (</span><span class='info'>Bradner, B., &ldquo;Key words for use in RFCs to Indicate Requirement           Levels,&rdquo; .</span><span>)</span></a>. Domain name examples use <a class='info' href='#RFC2606'>[RFC2606]<span> (</span><span class='info'>Eastlake, D. and A. Panitz, &ldquo;Reserved Top Level DNS Names,&rdquo; .</span><span>)</span></a>.
</p>
<a name="anchor2"></a><br /><hr />
<table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc">&nbsp;TOC&nbsp;</a></td></tr></table>
<a name="rfc.section.2"></a><h3>2.&nbsp;
Definitions</h3>

<p></p>
<blockquote class="text"><dl>
<dt>Topic:</dt>
<dd>An <a class='info' href='#RFC4287'>Atom<span> (</span><span class='info'>Nottingham, M., Ed. and R. Sayre, Ed., &ldquo;The Atom Syndication Format,&rdquo; .</span><span>)</span></a> [RFC4287] or <a class='info' href='#RSS20'>RSS<span> (</span><span class='info'>Winer, D., &ldquo;RSS 2.0,&rdquo; .</span><span>)</span></a> [RSS20] feed <a class='info' href='#RFC3986'>URL<span> (</span><span class='info'>Berners-Lee, T., &ldquo;Uniform Resource Identifiers (URI): Generic Syntax,&rdquo; .</span><span>)</span></a> [RFC3986]. The
          unit to which one can subscribe to changes. This spec currently only
          addresses feed URLs that require no additional authorization
          headers.
</dd>
<dt>Hub (&quot;the hub&quot;):</dt>
<dd>The server (<a class='info' href='#RFC3986'>URL<span> (</span><span class='info'>Berners-Lee, T., &ldquo;Uniform Resource Identifiers (URI): Generic Syntax,&rdquo; .</span><span>)</span></a> [RFC3986]) which implements both sides of this
          protocol. We have implemented this and are running a server at <a href='http://pubsubhubbub.appspot.com/'>http://pubsubhubbub.appspot.com</a> that is, at least for now, open
          to anybody for use, as either a publisher or subscriber. Any hub MAY
          implement its own policies on who can use it.
</dd>
<dt>Publisher:</dt>
<dd>An owner of a topic. Notifies the hub when
          the topic feed has been updated. It just notifies that it <em>has</em> been updated, but not how. As in almost all
          pubsub systems, the publisher is unaware of the subscribers, if any.
          Other pubsub systems might call the publisher the "source".
</dd>
<dt>Subscriber:</dt>
<dd>An entity (person or program) that wants
          to be notified of changes on a topic. The subscriber must be
          directly network-accessible and is identified by its Subscriber
          Callback URL.
</dd>
<dt>Subscription:</dt>
<dd>A unique relation to a topic by a
          subscriber that indicates it should receive updates for that topic. A
          subscription's unique key is the tuple (Topic URL, Subscriber Callback
          URL). Subscriptions may (at the hub's decision) have expiration times
          akin to DHCP leases which must be periodically renewed.
</dd>
<dt>Subscriber Callback URL:</dt>
<dd>The <a class='info' href='#RFC3986'>URL<span> (</span><span class='info'>Berners-Lee, T., &ldquo;Uniform Resource Identifiers (URI): Generic Syntax,&rdquo; .</span><span>)</span></a> [RFC3986] at which a subscriber wishes to receive
          notifications.
</dd>
<dt>Event:</dt>
<dd>An event that causes updates to multiple topics.
          For each event that happens (e.g. "Brad posted to the Linux
          Community."), multiple topics could be affected (e.g. "Brad posted."
          and "Linux community has new post"). Publisher events cause topics to
          be updated and the hub looks up all subscriptions for affected topics,
          sending out notifications to subscribers.
</dd>
<dt>Notification:</dt>
<dd>A payload describing how a topic's
          contents have changed. This difference (or "delta") is computed by the
          hub and sent to all subscribers. The format of the notification will
          be an Atom or RSS feed served by the publisher with only those entries
          present which are new or have changed. The notification can be the
          result of a publisher telling the hub of an update, or the hub
          proactively polling a topic feed, perhaps for a subscriber subscribing
          to a topic that's not pubsub-aware. Note also that a notification to a
          subscriber can be a payload consisting of updates for multiple topics.
          Hubs MAY choose to send multi-topic notifications as an optimization
          for heavy subscribers, but subscribers MUST understand them. See <a class='info' href='#contentdistribution'>Section&nbsp;7.3<span> (</span><span class='info'>Content Distribution</span><span>)</span></a> for format details.
</dd>
</dl></blockquote>

<a name="anchor3"></a><br /><hr />
<table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc">&nbsp;TOC&nbsp;</a></td></tr></table>
<a name="rfc.section.3"></a><h3>3.&nbsp;
High-level protocol flow</h3>

<p>(This section is non-normative.)
</p>
<p></p>
<ul class="text">
<li>Publishers POST a ping to their hub(s) URLs when their topic(s)
          change.
</li>
<li>Subscribers POST to one or more of the advertised hubs for a
          topic they're interested in. Alternatively, some hubs may offer
          auto-polling capability, to let {their,any} subscribers subscribe to
          topics which don't advertise a hub.
</li>
<li>The hub caches minimal metadata (id, data, entry digest) about
          each topic's previous state. When the hub re-fetches a topic feed (on
          its own initiative or as a result of a publisher's ping) and finds a
          delta, it enqueues a notification to all registered subscribers.
</li>
</ul>

<a name="anchor4"></a><br /><hr />
<table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc">&nbsp;TOC&nbsp;</a></td></tr></table>
<a name="rfc.section.4"></a><h3>4.&nbsp;
Atom Details</h3>

<p>Notification and source formats will be <a class='info' href='#RFC4287'>Atom<span> (</span><span class='info'>Nottingham, M., Ed. and R. Sayre, Ed., &ldquo;The Atom Syndication Format,&rdquo; .</span><span>)</span></a> [RFC4287] or <a class='info' href='#RSS20'>RSS<span> (</span><span class='info'>Winer, D., &ldquo;RSS 2.0,&rdquo; .</span><span>)</span></a> [RSS20]. The
      Publisher makes the decision as to include full body, truncated body, or
      meta data of most recent event(s). One of:
</p>
<p></p>
<ul class="text">
<li>URL + metadata
</li>
<li>URL + metadata + truncated
</li>
<li>URL + metadata + full
</li>
</ul>

<p>The trade-off between including all content in outgoing notifications
      or having the thundering herd (by clients who fetch the <tt>//atom:feed/entry/link</tt> in response to a notification)
      is up to the publisher. Entries of the most recent events (for recipient
      to know whether or not they'd missed any recent items-- like TCP SACK) MAY
      be provided as context. Some examples of Atom feed entries follow.
</p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre>&lt;?xml version="1.0"?&gt;
&lt;atom:feed&gt;
  &lt;!-- Normally here would be source, title, author, id, etc ... --&gt;

  &lt;link rel="hub" href="http://myhub.example.com/endpoint" /&gt;
  &lt;link rel="self" href="http://publisher.example.com/happycats.xml" /&gt;
  &lt;updated&gt;2008-08-11T02:15:01Z&lt;/updated&gt;

  &lt;!-- Example of a full entry. --&gt;
  &lt;entry&gt;
    &lt;title&gt;Heathcliff&lt;/title&gt;
    &lt;link href="http://publisher.example.com/happycat25.xml" /&gt;
    &lt;id&gt;http://publisher.example.com/happycat25.xml&lt;/id&gt;
    &lt;updated&gt;2008-08-11T02:15:01Z&lt;/updated&gt;
    &lt;content&gt;
      What a happy cat. Full content goes here.
    &lt;/content&gt;
  &lt;/entry&gt;

  &lt;!-- Example of an entity that isn't full/is truncated. This is implied
       by the lack of a &lt;content&gt; element and a &lt;summary&gt; element instead. --&gt;
  &lt;entry &gt;
    &lt;title&gt;Heathcliff&lt;/title&gt;
    &lt;link href="http://publisher.example.com/happycat25.xml" /&gt;
    &lt;id&gt;http://publisher.example.com/happycat25.xml&lt;/id&gt;
    &lt;updated&gt;2008-08-11T02:15:01Z&lt;/updated&gt;
    &lt;summary&gt;
      What a happy cat!
    &lt;/summary&gt;
  &lt;/entry&gt;

  &lt;!-- Meta-data only; implied by the lack of &lt;content&gt; and
       &lt;summary&gt; elements. --&gt;
  &lt;entry&gt;
    &lt;title&gt;Garfield&lt;/title&gt;
    &lt;link rel="alternate" href="http://publisher.example.com/happycat24.xml" /&gt;
    &lt;id&gt;http://publisher.example.com/happycat25.xml&lt;/id&gt;
    &lt;updated&gt;2008-08-11T02:15:01Z&lt;/updated&gt;
  &lt;/entry&gt;

  &lt;!-- Context entry that's meta-data only and not new. --&gt;
  &lt;entry&gt;
    &lt;title&gt;Nermal&lt;/title&gt;
    &lt;link rel="alternate" href="http://publisher.example.com/happycat23s.xml" /&gt;
    &lt;id&gt;http://publisher.example.com/happycat25.xml&lt;/id&gt;
    &lt;updated&gt;2008-07-10T12:28:13Z&lt;/updated&gt;
  &lt;/entry&gt;

&lt;/atom:feed&gt;
</pre></div>
<a name="discovery"></a><br /><hr />
<table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc">&nbsp;TOC&nbsp;</a></td></tr></table>
<a name="rfc.section.5"></a><h3>5.&nbsp;
Discovery</h3>

<p>A potential subscriber initiates discovery by retrieving the feed to
      which it wants to subscribe. A feed that acts as a topic as per this
      specification MUST publish, as a child of <tt>//atom:feed</tt> or <tt>//rss:rss/channel</tt> , an <tt>atom:link</tt> element whose <tt>rel</tt> attribute has the value <tt>hub</tt> and whose <tt>href</tt>
      attribute contains the hub's endpoint URL. Feeds MAY contain multiple
      <tt>atom:link[@rel="hub"]</tt> elements if the
      publisher wishes to notify multiple hubs. When a potential subscriber
      encounters one or more such links, that subscriber MAY subscribe to the
      feed using one or more hubs URLs as described in <a class='info' href='#subscribing'>Section&nbsp;6<span> (</span><span class='info'>Subscribing and Unsubscribing</span><span>)</span></a>.
</p>
<p>Example:
</p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre>&lt;?xml version="1.0"?&gt;
&lt;atom:feed&gt;
  &lt;!-- Normally here would be source, title, author, id, etc ... --&gt;
  &lt;link rel="hub" href="https://myhub.example.com/endpoint" /&gt;
  &lt;link rel="self" href="http://publisher.example.com/topic.xml" /&gt;
  ....
  &lt;entry&gt;
     ....
  &lt;/entry&gt;
  &lt;entry&gt;
     ....
  &lt;/entry&gt;
&lt;/atom:feed&gt;
</pre></div>
<p>Hubs MUST use the same URL for both the publishing and subscribing
    interfaces, which is why only a single <tt>atom:link</tt>
    element is required to declare a hub. Publishers SHOULD use <a class='info' href='#RFC2616'>HTTPS<span> (</span><span class='info'>Fielding, R., Gettys, J., Mogul, J., Frystyk, H., Masinter, L., Leach, P., and T. Berners-Lee, &ldquo;Hypertext Transfer Protocol -- HTTP/1.1,&rdquo; .</span><span>)</span></a> [RFC2616] in their hubs' discovery URLs. However,
    subscribers that do not support <a class='info' href='#RFC2818'>HTTPS<span> (</span><span class='info'>Rescorla, E., &ldquo;HTTP Over TLS,&rdquo; May&nbsp;2000.</span><span>)</span></a> [RFC2818] MAY
    try to fallback to <a class='info' href='#RFC2616'>HTTP<span> (</span><span class='info'>Fielding, R., Gettys, J., Mogul, J., Frystyk, H., Masinter, L., Leach, P., and T. Berners-Lee, &ldquo;Hypertext Transfer Protocol -- HTTP/1.1,&rdquo; .</span><span>)</span></a> [RFC2616], which MAY work
    depending on the hub's policy.
</p>
<a name="subscribing"></a><br /><hr />
<table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc">&nbsp;TOC&nbsp;</a></td></tr></table>
<a name="rfc.section.6"></a><h3>6.&nbsp;
Subscribing and Unsubscribing</h3>

<p>Subscribing to a topic URL consists of three parts that may occur
      immediately in sequence or have a delay.
</p>
<p></p>
<ul class="text">
<li>Requesting a subscription using the hub
</li>
<li>Confirming the subscription was actually desired
</li>
<li>Periodically reconfirming the subscription is still active
</li>
</ul>

<p>Unsubscribing works in the same way, except with a single parameter
      changed to indicate the desire to unsubscribe.
</p>
<a name="anchor5"></a><br /><hr />
<table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc">&nbsp;TOC&nbsp;</a></td></tr></table>
<a name="rfc.section.6.1"></a><h3>6.1.&nbsp;
Subscriber Sends Subscription Request</h3>

<p>Subscription is initiated by the subscriber making an <a class='info' href='#RFC2616'>HTTP<span> (</span><span class='info'>Fielding, R., Gettys, J., Mogul, J., Frystyk, H., Masinter, L., Leach, P., and T. Berners-Lee, &ldquo;Hypertext Transfer Protocol -- HTTP/1.1,&rdquo; .</span><span>)</span></a> [RFC2616] POST request to the hub URL. This request
        has a Content-Type of <tt>application/x-www-form-urlencoded</tt> (described in
        Section 17.13.4 of <a class='info' href='#W3C.REC-html401-19991224'>[W3C.REC&#8209;html401&#8209;19991224]<span> (</span><span class='info'>Raggett, D., Hors, A., and I. Jacobs, &ldquo;HTML 4.01 Specification,&rdquo; December&nbsp;1999.</span><span>)</span></a>) and the
        following parameters in its body:
</p>
<p></p>
<blockquote class="text"><dl>
<dt>hub.callback</dt>
<dd>REQUIRED. The subscriber's callback URL where notifications should be delivered.
</dd>
<dt>hub.mode</dt>
<dd>REQUIRED. The literal string "subscribe" or
            "unsubscribe", depending on the goal of the request.
</dd>
<dt>hub.topic</dt>
<dd>REQUIRED. The topic URL that the subscriber
            wishes to subscribe to.
</dd>
<dt>hub.verify</dt>
<dd>REQUIRED. Keyword describing verification
            modes supported by this subscriber, as described below. This
            parameter may be repeated to indicate multiple supported modes.
</dd>
<dt>hub.lease_seconds</dt>
<dd>OPTIONAL. Number of seconds for
            which the subscriber would like to have the subscription active. If
            not present or an empty value, the subscription will be permanent
            (or active until <a class='info' href='#autorefresh'>automatic
            refreshing<span> (</span><span class='info'>Automatic Subscription Refreshing</span><span>)</span></a> removes the subscription). Hubs MAY choose to
            respect this value or not, depending on their own policies. This
            parameter MAY be present for unsubscription requests and MUST be
            ignored by the hub in that case.
</dd>
<dt>hub.secret</dt>
<dd>OPTIONAL. A subscriber-provided secret
            string that will be used to compute an HMAC digest for <a class='info' href='#authednotify'>authorized content distribution<span> (</span><span class='info'>Authenticated Content Distribution</span><span>)</span></a>. If not
            supplied, the HMAC digest will not be present for content
            distribution requests. This parameter SHOULD only be specified when
            the request was made over <a class='info' href='#RFC2818'>HTTPS<span> (</span><span class='info'>Rescorla, E., &ldquo;HTTP Over TLS,&rdquo; May&nbsp;2000.</span><span>)</span></a> [RFC2818]. This
            parameter MUST be less than 200 bytes in length.
</dd>
<dt>hub.verify_token</dt>
<dd>OPTIONAL. A subscriber-provided
            opaque token that will be echoed back in the verification request to
            assist the subscriber in identifying which subscription request is
            being verified. If this is not included, no token will be included
            in the verification request.
</dd>
</dl></blockquote>

<p>The following keywords are supported for hub.verify:
</p>
<p></p>
<blockquote class="text"><dl>
<dt>sync</dt>
<dd>The subscriber supports synchronous
            verification, where the verification request must occur before the
            subscription request's HTTP response is returned.
</dd>
<dt>async</dt>
<dd>The subscriber supports asynchronous
            verification, where the verification request may occur at a later
            point after the subscription request has returned.
</dd>
</dl></blockquote>

<p>Where repeated keywords are used, their order indicates the
          subscriber's order of preference. Subscribers MUST use at least one of
          the modes indicated in the list above, but MAY include additional
          keywords defined by extension specifications. Hubs MUST ignore verify
          mode keywords that they do not understand.
</p>
<p>Hubs MUST ignore additional request parameters they do not
          understand.
</p>
<p>Hubs MUST allow subscribers to re-request subscriptions that are
          already activate. Each subsequent request to a hub to subscribe or
          unsubscribe MUST override the previous subscription state for a
          specific topic URL and callback URL combination once the action is
          verified. Any failures to confirm the subscription action MUST leave
          the subscription state unchanged. This is required so subscribers can
          renew their subscriptions before the lease seconds period is over
          without any interruption.
</p>
<a name="anchor6"></a><br /><hr />
<table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc">&nbsp;TOC&nbsp;</a></td></tr></table>
<a name="rfc.section.6.1.1"></a><h3>6.1.1.&nbsp;
Subscription Parameter Details</h3>

<p>The topic and callback URLs MUST NOT contain an anchor fragment.
          These URLs MAY use <a class='info' href='#RFC2616'>HTTP<span> (</span><span class='info'>Fielding, R., Gettys, J., Mogul, J., Frystyk, H., Masinter, L., Leach, P., and T. Berners-Lee, &ldquo;Hypertext Transfer Protocol -- HTTP/1.1,&rdquo; .</span><span>)</span></a> [RFC2616] or <a class='info' href='#RFC2818'>HTTPS<span> (</span><span class='info'>Rescorla, E., &ldquo;HTTP Over TLS,&rdquo; May&nbsp;2000.</span><span>)</span></a> [RFC2818] schemes. These URLs MAY have port
          numbers specified; however, hubs MAY choose to disallow certain ports
          based on their own policies (e.g., security) and return errors for
          these requests. The topic URL can otherwise be free-form following
          <a class='info' href='#RFC3986'>the URI spec<span> (</span><span class='info'>Berners-Lee, T., &ldquo;Uniform Resource Identifiers (URI): Generic Syntax,&rdquo; .</span><span>)</span></a> [RFC3986]. Hubs MUST always decode
          non-reserved characters for these URL parameters; see section 2.4 on
          <em>"When to Encode or Decode"</em> in <a class='info' href='#RFC3986'>the URI spec<span> (</span><span class='info'>Berners-Lee, T., &ldquo;Uniform Resource Identifiers (URI): Generic Syntax,&rdquo; .</span><span>)</span></a> [RFC3986].
</p>
<p>The callback URL MAY contain arbitrary query string parameters
          (e.g., <tt>?foo=bar&red=fish</tt>). Hubs MUST
          preserve the query string during subscription verification by
          appending new parameters to the end of the list using the <tt>&</tt> (ampersand) character to join. Existing
          parameters with names that overlap with those used by verification
          requests will not be overwritten; Hubs MUST only append verification
          parameters to the existing list, if any. For event notification, the
          callback URL will be POSTed to including any query-string parameters
          in the URL portion of the request, not as POST body parameters.
</p>
<p>Subscribers MAY choose to use <a class='info' href='#RFC2818'>HTTPS<span> (</span><span class='info'>Rescorla, E., &ldquo;HTTP Over TLS,&rdquo; May&nbsp;2000.</span><span>)</span></a> [RFC2818]
          for their callback URLs if they care about the privacy of
          notifications as they come over the wire from the Hub. The use of
          mechanisms (such as XML signatures) to verify the integrity of
          notifications coming from the original publisher is out of the scope
          of this specification.
</p>
<a name="anchor7"></a><br /><hr />
<table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc">&nbsp;TOC&nbsp;</a></td></tr></table>
<a name="rfc.section.6.1.2"></a><h3>6.1.2.&nbsp;
Subscription Response Details</h3>

<p>The hub MUST respond to a subscription request with an HTTP 204 "No
          Content" response to indicate that the request was verified and that
          the subscription is active. If the subscription has yet to be verified
          (i.e., the hub is using asynchronous verification), the hub MUST
          respond with a 202 "Accepted" code.
</p>
<p>If a hub finds any errors in the subscription request, an
          appropriate HTTP error response code (4xx or 5xx) MUST be returned. In
          the event of an error, hubs SHOULD return a description of the error
          in the response body as plain text. Hubs MAY decide to reject some
          callback URLs or topic URLs based on their own policies (e.g., domain
          authorization, topic URL port numbers).
</p>
<p>In synchronous mode, the verification (<a class='info' href='#verifysub'>Section&nbsp;6.2<span> (</span><span class='info'>Hub Verifies Intent of the Subscriber</span><span>)</span></a>) MUST be completed before the hub returns a
          response. In asynchronous mode, the verification MAY be deferred until
          a later time. This is useful to enable hubs to defer work; this could
          allow them to alleviate servers under heavy load or do verification
          work in batches.
</p>
<a name="verifysub"></a><br /><hr />
<table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc">&nbsp;TOC&nbsp;</a></td></tr></table>
<a name="rfc.section.6.2"></a><h3>6.2.&nbsp;
Hub Verifies Intent of the Subscriber</h3>

<p>In order to prevent an attacker from creating unwanted subscriptions
        on behalf of a subscriber (or unsubscribing desired ones), a hub must
        ensure that the subscriber did indeed send the subscription request.
</p>
<p>The hub verifies a subscription request by sending an <a class='info' href='#RFC2616'>HTTP<span> (</span><span class='info'>Fielding, R., Gettys, J., Mogul, J., Frystyk, H., Masinter, L., Leach, P., and T. Berners-Lee, &ldquo;Hypertext Transfer Protocol -- HTTP/1.1,&rdquo; .</span><span>)</span></a> [RFC2616] GET request to the subscriber's callback
        URL as given in the subscription request. This request has the following
        query string arguments appended (format described in Section 17.13.4 of
        <a class='info' href='#W3C.REC-html401-19991224'>[W3C.REC&#8209;html401&#8209;19991224]<span> (</span><span class='info'>Raggett, D., Hors, A., and I. Jacobs, &ldquo;HTML 4.01 Specification,&rdquo; December&nbsp;1999.</span><span>)</span></a>):
</p>
<p></p>
<blockquote class="text"><dl>
<dt>hub.mode</dt>
<dd>REQUIRED. The literal string "subscribe" or
            "unsubscribe", which matches the original request to the hub from
            the subscriber.
</dd>
<dt>hub.topic</dt>
<dd>REQUIRED. The topic URL given in the
            corresponding subscription request.
</dd>
<dt>hub.challenge</dt>
<dd>REQUIRED. A hub-generated, random string
            that MUST be echoed by the subscriber to verify the
            subscription.
</dd>
<dt>hub.lease_seconds</dt>
<dd>REQUIRED/OPTIONAL. The
            hub-determined number of seconds that the subscription will stay
            active before expiring, measured from the time the verification
            request was made from the hub to the subscriber. Hubs MUST supply
            this parameter for subscription requests. This parameter MAY be
            present for unsubscribe requests and MUST be ignored by subscribers
            during unsubscription.
</dd>
<dt>hub.verify_token</dt>
<dd>OPTIONAL. The subscriber-provided
            opaque token from the corresponding subscription request, if one was
            provided.
</dd>
</dl></blockquote>

<a name="anchor8"></a><br /><hr />
<table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc">&nbsp;TOC&nbsp;</a></td></tr></table>
<a name="rfc.section.6.2.1"></a><h3>6.2.1.&nbsp;
Verification Details</h3>

<p>The subscriber MUST confirm that the <tt>hub.topic
          </tt> and <tt>hub.verify_token</tt> correspond
          to a pending subscription or unsubscription that it wishes to carry
          out. If so, the subscriber MUST respond with an HTTP success (2xx)
          code with a response body equal to the <tt>hub.challenge</tt> parameter. If the subscriber does
          not agree with the action, the subscriber MUST respond with a 404 "Not
          Found" response.
</p>
<p>For synchronous verification, the hub MUST consider other server
          response codes (3xx, 4xx, 5xx) to mean that the verification request
          has immediately failed and no retries should occur. If the subscriber
          returns an HTTP success (2xx) but the content body does not match the
          <tt>hub.challenge</tt> parameter, the hub MUST also
          consider verification to have failed.
</p>
<p>For asynchronous verification, the hub MUST consider other server
          response codes (3xx, 4xx, and 5xx) to mean that the subscription
          action was <em>temporarily</em> not verified. If
          the subscriber returns an HTTP success (2xx) but the content body does
          not match the <tt>hub.challenge</tt> parameter, the
          hub MUST consider this to be a <em>temporary</em>
          failure and retry. The hub SHOULD retry verification a reasonable
          number of times over the course of a longer time period (e.g., 6
          hours) until a definite acknowledgement (positive or negative) is
          received. If a definite response still cannot be determined after this
          retry period, the subscription action verification MUST be abandoned,
          leaving the previous subscription state.
</p>
<p>Hubs MAY make the <tt>hub.lease_seconds</tt>
          equal to the period the subscriber passed in their subscription
          request but MAY change the value depending on the hub's policies. To
          sustain a temporary subscription, the subscriber MUST re-request the
          subscription on the hub before <tt>hub.lease_seconds</tt> seconds has elapsed. For
          permanent subscriptions with no <tt>hub.lease_seconds</tt> value specified, the behavior
          is different as described in the section on <a class='info' href='#autorefresh'>automatic subscription refreshing<span> (</span><span class='info'>Automatic Subscription Refreshing</span><span>)</span></a>.
</p>
<a name="autorefresh"></a><br /><hr />
<table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc">&nbsp;TOC&nbsp;</a></td></tr></table>
<a name="rfc.section.6.3"></a><h3>6.3.&nbsp;
Automatic Subscription Refreshing</h3>

<p>Before a subscription expires (i.e., before <tt>hub.lease_seconds</tt> elapses), Hubs MUST recheck with
        subscribers to see if a continued subscription is desired. Hubs do this
        by sending the subscriber a <a class='info' href='#verifysub'>verification
        request<span> (</span><span class='info'>Hub Verifies Intent of the Subscriber</span><span>)</span></a> with <tt>hub.mode</tt> equal to
        subscribe. This request MUST match the original verification request
        sent to the subscriber (but with a new <tt>hub.challenge</tt>).
</p>
<p>The response codes returned by the subscriber MUST be interpreted the
        same way as during a subscriber-initiated verification flow. However,
        this refresh request MUST behave like an initial subscription request;
        this means that if an auto-refresh response from the subscriber
        constantly returns an error, the hub MUST give up on the subscription
        verification action altogether and remove the subscription.
</p>
<p>In the case of permanent subscriptions (with no <tt>hub.lease_seconds</tt> specified in the original
        request), the <tt>hub.lease_seconds</tt> value
        supplied by the hub in the verification request to the subscriber SHOULD
        represent how many seconds until the hub expects it will next initiate
        automatic subscription refreshing to ensure that the subscriber is still
        interested in the topic. This behavior provides the best of both worlds:
        maximum simplicity of the subscriber through infinitely-long
        subscriptions, but still garbage collectable subscriptions for hub
        hygiene.
</p>
<a name="publishing"></a><br /><hr />
<table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc">&nbsp;TOC&nbsp;</a></td></tr></table>
<a name="rfc.section.7"></a><h3>7.&nbsp;
Publishing</h3>

<p>A publisher pings the hub with the topic URL(s) which have been updated
      and the hub schedules those topics to be fetched and delivered. Because
      it's just a ping to notify the hub of the topic URL (without a payload),
      no authentication from the publisher is required.
</p>
<a name="anchor9"></a><br /><hr />
<table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc">&nbsp;TOC&nbsp;</a></td></tr></table>
<a name="rfc.section.7.1"></a><h3>7.1.&nbsp;
New Content Notification</h3>

<p>When new content is added to a feed, a notification is sent to
        the hub by the publisher. The hub MUST accept a POST request to
        the hub URL containing the notification. This request MUST have a
        Content-Type of <tt>application/x-www-form-urlencoded
        </tt> (described in Section 17.13.4 of <a class='info' href='#W3C.REC-html401-19991224'>[W3C.REC&#8209;html401&#8209;19991224]<span> (</span><span class='info'>Raggett, D., Hors, A., and I. Jacobs, &ldquo;HTML 4.01 Specification,&rdquo; December&nbsp;1999.</span><span>)</span></a>) and the following parameters in
        its body:
</p>
<p></p>
<blockquote class="text"><dl>
<dt>hub.mode</dt>
<dd>REQUIRED. The literal string "publish".
</dd>
<dt>hub.url</dt>
<dd>REQUIRED. The topic URL of the topic that
            has been updated. This field may be repeated to indicate multiple
            topics that have been updated.
</dd>
</dl></blockquote>

<p>The new content notification is a signal to the hub that there is new
        content available. The hub SHOULD arrange for a content fetch request
        (<a class='info' href='#contentfetch'>Section&nbsp;7.2<span> (</span><span class='info'>Content Fetch</span><span>)</span></a>) to be performed in the near future
        to retrieve the new content. If the notification was acceptable, the hub
        MUST return a 204 No Content response. If the notification is not
        acceptable for some reason, the hub MUST return an appropriate HTTP
        error response code (4xx and 5xx). Hubs MUST return a 204 No Content
        response even when they do not have any subscribers for all of the
        specified topic URLs.
</p>
<a name="contentfetch"></a><br /><hr />
<table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc">&nbsp;TOC&nbsp;</a></td></tr></table>
<a name="rfc.section.7.2"></a><h3>7.2.&nbsp;
Content Fetch</h3>

<p>When the hub wishes to retrieve new content for a topic, the hub
        sends an <a class='info' href='#RFC2616'>HTTP<span> (</span><span class='info'>Fielding, R., Gettys, J., Mogul, J., Frystyk, H., Masinter, L., Leach, P., and T. Berners-Lee, &ldquo;Hypertext Transfer Protocol -- HTTP/1.1,&rdquo; .</span><span>)</span></a> [RFC2616] GET request to the topic
        URL. The hub MUST follow HTTP redirects. The Hub SHOULD use best
        practices for caching headers in its requests (e.g., <tt>If-None-Match</tt>, <tt>If-Modified-Since</tt>).
</p>
<p>The request SHOULD include the header field <tt>User-Agent</tt> in the form expected by <a class='info' href='#RFC2616'>HTTP<span> (</span><span class='info'>Fielding, R., Gettys, J., Mogul, J., Frystyk, H., Masinter, L., Leach, P., and T. Berners-Lee, &ldquo;Hypertext Transfer Protocol -- HTTP/1.1,&rdquo; .</span><span>)</span></a> [RFC2616]. The header MAY have one or more additional
        suffixes like <tt>(example.com; 20 subscribers)</tt>
        to indicate the number of subscriptions the hub has active for this
        topic.
</p>
<p>If present, the first suffix MUST indicate the total number of
        subscriptions the hub has aggregated across all subscriber domains by
        means of the <tt>X-Hub-On-Behalf-Of</tt> header
        (<a class='info' href='#contentdistribution'>Section&nbsp;7.3<span> (</span><span class='info'>Content Distribution</span><span>)</span></a>). Any additional suffixes
        indicate a breakdown of subscriber counts across subscriber domains.
        This allows content publishers to distinguish the source of their
        subscriber counts and mitigate subscriber count spam. An example header
        could be (ignoring line-wrapping):
</p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre>
User-Agent: MyHub (+http://hub.example.com; 26 subscribers)
    (sub.example.com; 4 subscribers)
    (other-sub.example.com; 22 subscribers)
</pre></div>
<p>If, after a content fetch, the hub determines that the topic feed
        content has changed, the hub MUST send information about the changes to
        each of the subscribers to the topic (<a class='info' href='#contentdistribution'>Section&nbsp;7.3<span> (</span><span class='info'>Content Distribution</span><span>)</span></a>). Hubs MUST consider new feed
        entries, updated entries, or changes to the surrounding feed document as
        significant content changes that require content distribution.
</p>
<a name="contentdistribution"></a><br /><hr />
<table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc">&nbsp;TOC&nbsp;</a></td></tr></table>
<a name="rfc.section.7.3"></a><h3>7.3.&nbsp;
Content Distribution</h3>

<p>A content distribution request is an <a class='info' href='#RFC2616'>HTTP<span> (</span><span class='info'>Fielding, R., Gettys, J., Mogul, J., Frystyk, H., Masinter, L., Leach, P., and T. Berners-Lee, &ldquo;Hypertext Transfer Protocol -- HTTP/1.1,&rdquo; .</span><span>)</span></a> [RFC2616] POST request from hub to the subscriber's
        callback URL with the list of new and changed entries. This request MUST
        have a <tt>Content-Type</tt> of <tt>application/atom+xml</tt> when the request body is an
        <a class='info' href='#RFC4287'>Atom<span> (</span><span class='info'>Nottingham, M., Ed. and R. Sayre, Ed., &ldquo;The Atom Syndication Format,&rdquo; .</span><span>)</span></a> [RFC4287] feed document, or a <tt>Content-Type</tt> of <tt>application/rss+xml</tt> when the request body is an
        <a class='info' href='#RSS20'>RSS<span> (</span><span class='info'>Winer, D., &ldquo;RSS 2.0,&rdquo; .</span><span>)</span></a> [RSS20] feed document. The behavior for other
        content types is not yet defined. Hubs MAY transform the content type
        and request body as desired (e.g., for language translation).
</p>
<p>If the document represents a single feed being replicated for the
        subscriber, then the feed-level elements SHOULD be preserved aside from
        the <tt>atom:entry</tt> or <tt>rss:item</tt> elements. However, the <tt>atom:id</tt> element MUST be reproduced exactly. The
        other <tt>atom:updated</tt> and <tt>atom:title</tt> elements required by the Atom
        specification SHOULD be present. Each <tt>atom:entry</tt> or <tt>rss:item</tt>
        element in the feed contains the content from an entry in the single
        topic that the subscriber has an active subscription for. Essentially,
        in the single feed case the subscriber will receive a feed document
        that looks like the original but with old content removed.
</p>
<p>The successful response from the subscriber's callback URL MUST be an
        HTTP success (2xx) code. The hub MUST consider all other subscriber
        response codes as failures; that means subscribers MUST not use HTTP
        redirects for moving subscriptions. The response body from the
        subscriber MUST be ignored by the hub. Hubs SHOULD retry notifications
        repeatedly until successful (up to some reasonable maximum over a
        reasonable time period). Subscribers SHOULD respond to notifications as
        quickly as possible; their success response code SHOULD only indicate
        receipt of the message, not acknowledgment that it was successfully
        processed by the subscriber.
</p>
<p>The subscriber's callback response MAY include the header field
        <tt>X-Hub-On-Behalf-Of</tt> with an integer value,
        possibly approximate, representing the number of subscribers on behalf
        of which this feed notification was delivered. This value SHOULD be
        aggregated by the hub across all subscribers and used to provide the
        subscriber counts in the <tt>User-Agent</tt> header
        field sent to publishers (<a class='info' href='#contentfetch'>Section&nbsp;7.2<span> (</span><span class='info'>Content Fetch</span><span>)</span></a>). Hubs MAY
        ignore or respect <tt>X-Hub-On-Behalf-Of</tt> values
        from subscribers depending on their own policies (i.e., to prevent
        spam).
</p>
<a name="authednotify"></a><br /><hr />
<table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc">&nbsp;TOC&nbsp;</a></td></tr></table>
<a name="rfc.section.7.4"></a><h3>7.4.&nbsp;
Authenticated Content Distribution</h3>

<p>If the subscriber supplied a value for <tt>hub.secret</tt> in their subscription request, the hub
        MUST generate an HMAC signature of the payload and include that
        signature in the request headers of the content distribution request.
        The <tt>X-Hub-Signature</tt> header's value MUST be
        in the form <tt>sha1=signature</tt> where <tt>signature</tt> is a 40-byte, hexadecimal representation
        of a <a class='info' href='#RFC3174'>SHA1 signature<span> (</span><span class='info'>Eastlake, D. and P. Jones, &ldquo;US Secure Hash Algorithm 1 (SHA1),&rdquo; September&nbsp;2001.</span><span>)</span></a> [RFC3174]. The signature MUST be
        computed using the <a class='info' href='#RFC2104'>HMAC algorithm<span> (</span><span class='info'>Krawczyk, H., Bellare, M., and R. Canetti, &ldquo;HMAC: Keyed-Hashing for Message Authentication,&rdquo; .</span><span>)</span></a> [RFC2104] with the
        request body as the data and the <tt>hub.secret</tt>
        as the key.
</p>
<p>When subscribers receive a content distribution request with the
        <tt>X-Hub-Signature</tt> header specified, they
        SHOULD recompute the SHA1 signature with the shared secret using the
        same method as the hub. If the signature does not match, subscribers
        MUST still return a 2xx success response to acknowledge receipt, but
        locally ignore the message as invalid. Using this technique along with
        HTTPS for subscription requests enables simple subscribers to receive
        authenticated content delivery from hubs without the need for
        subscribers to run an HTTPS server.
</p>
<a name="aggregatedistribution"></a><br /><hr />
<table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc">&nbsp;TOC&nbsp;</a></td></tr></table>
<a name="rfc.section.7.5"></a><h3>7.5.&nbsp;
Aggregated Content Distribution</h3>

<p>For Atom feeds only. Pending further review.
</p>
<p>When a subscriber indicates the same callback URL is used for
        multiple subscriptions, hubs MAY choose to combine content delivery
        requests into a single payload containing an aggregated set of feeds.
        This bulk delivery results in fewer requests and more efficient
        distribution. If the subscriber indicated a <tt>hub.secret</tt> value for these overlapping
        subscriptions, the secret MUST also be the same for all subscriptions.
        This allows the hub to generate a single <tt>X-Hub-Signature</tt> header to sign the entire payload.
        Hubs MUST return an error response (4xx, 5xx) for subscription
        requests with overlapping callback URLs and different secret values.
        
</p>
<p>With an aggregated set of feeds, the hub SHOULD reproduce all of the
        elements from the source feed <em>inside</em> the
        corresponding <tt>atom:entry</tt> in the content
        distribution request by using an <tt>atom:source</tt>
        element. However, the <tt>atom:id</tt> value MUST be
        reproduced exactly within the source element. If the source entry does
        not have an <tt>atom:source</tt> element, the hub
        MUST create an <tt>atom:source</tt> element
        containing the <tt>atom:id</tt> element. The hub
        SHOULD also include the <tt>atom:title</tt> element
        and an <tt>atom:link</tt> element with <tt>rel="self"</tt> values that are functionally
        equivalent to the corresponding elements in the original topic feed.
</p>
<p>Example aggregated feed:
</p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre>&lt;?xml version="1.0"?&gt;
&lt;atom:feed&gt;
  &lt;title&gt;Aggregated feed&lt;/title&gt;
  &lt;updated&gt;2008-08-11T02:17:44Z&lt;/updated&gt;
  &lt;id&gt;http://myhub.example.com/aggregated?1232427842-39823&lt;/id&gt;

  &lt;entry&gt;
    &lt;source&gt;
      &lt;id&gt;http://www.example.com/foo&lt;/id&gt;
      &lt;link rel="self" href="http://publisher.example.com/foo.xml" /&gt;
      &lt;author&gt;
        &lt;name&gt;Mr. Bar&lt;/name&gt;
      &lt;/author&gt;
    &lt;/source&gt;
    &lt;title&gt;Testing Foo&lt;/title&gt;
    &lt;link href="http://publisher.example.com/foo24.xml" /&gt;
    &lt;id&gt;http://publisher.example.com/foo24.xml&lt;/id&gt;
    &lt;updated&gt;2008-08-11T02:15:01Z&lt;/updated&gt;
    &lt;content&gt;
      This is some content from the user named foo.
    &lt;/content&gt;
  &lt;/entry&gt;

  &lt;entry&gt;
    &lt;source&gt;
      &lt;id&gt;http://www.example.com/bar&lt;/id&gt;
      &lt;link rel="self" href="http://publisher.example.com/bar.xml" /&gt;
      &lt;author&gt;
        &lt;name&gt;Mr. Bar&lt;/name&gt;
      &lt;/author&gt;
    &lt;/source&gt;
    &lt;title&gt;Testing Bar&lt;/title&gt;
    &lt;link href="http://publisher.example.com/bar18.xml" /&gt;
    &lt;id&gt;http://publisher.example.com/bar18.xml&lt;/id&gt;
    &lt;updated&gt;2008-08-11T02:17:44Z&lt;/updated&gt;
    &lt;content&gt;
      Some data from the user named bar.
    &lt;/content&gt;
  &lt;/entry&gt;

&lt;/atom:feed&gt;
</pre></div>
<a name="bestpractices"></a><br /><hr />
<table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc">&nbsp;TOC&nbsp;</a></td></tr></table>
<a name="rfc.section.8"></a><h3>8.&nbsp;
Best Practices</h3>

<p>(This section is non-normative.)
</p>
<a name="hubbestpractices"></a><br /><hr />
<table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc">&nbsp;TOC&nbsp;</a></td></tr></table>
<a name="rfc.section.8.1"></a><h3>8.1.&nbsp;
For Hubs</h3>

<p>The vast majority of feeds on the web have multiple <em>variants</em> that contain essentially the same content
        but appear on different URLs. A common set of variants is <tt>http://example.com/feed?format=atom</tt> and <tt>http://example.com/feed?format=rss</tt>. In practice,
        these URLs also fail to set their <tt>//atom:feed/link[@rel="self"]</tt> values properly,
        meaning it's difficult for subscribers to discover which feed URL they
        truly wanted. Making matters worse, feeds often have redirects
        (temporary or permanent) to new hosting locations, analytics providers,
        or other feed-processors. To solve this, it's important for Hub
        implementations to determine feed URL equivalences using heuristics.
        Examples: follow all feed URLs redirects and see if they end up at the
        same location; use overlaps in feed HTML alternate links; use the <tt>atom:id</tt> value across all domains. This specific
        problem is considered out of scope of this specification but this
        section is meant as a reminder to implementors that feed URL aliasing is
        an important issue that hubs should address instead of putting
        the burden on publishers and subscribers.
</p>
<a name="subbestpractices"></a><br /><hr />
<table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc">&nbsp;TOC&nbsp;</a></td></tr></table>
<a name="rfc.section.8.2"></a><h3>8.2.&nbsp;
For Subscribers</h3>

<p>The <tt>hub.verify_token</tt> parameter in
        subscription requests enables subscribers to verify the identity and
        intent of the hub making the verification request. Subscribers should
        use the token to retrieve internal state to ensure the subscription
        request outcome is what they intended.
</p>
<a name="rfc.references1"></a><br /><hr />
<table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc">&nbsp;TOC&nbsp;</a></td></tr></table>
<h3>9.&nbsp;References</h3>
<table width="99%" border="0">
<tr><td class="author-text" valign="top"><a name="RFC2104">[RFC2104]</a></td>
<td class="author-text">Krawczyk, H., Bellare, M., and R. Canetti, &ldquo;<a href="http://tools.ietf.org/html/rfc2104">HMAC: Keyed-Hashing for Message Authentication</a>,&rdquo; RFC&nbsp;2104.</td></tr>
<tr><td class="author-text" valign="top"><a name="RFC2119">[RFC2119]</a></td>
<td class="author-text">Bradner, B., &ldquo;<a href="http://tools.ietf.org/html/rfc2119">Key words for use in RFCs to Indicate Requirement
          Levels</a>,&rdquo; RFC&nbsp;2119.</td></tr>
<tr><td class="author-text" valign="top"><a name="RFC2606">[RFC2606]</a></td>
<td class="author-text">Eastlake, D. and A. Panitz, &ldquo;<a href="http://tools.ietf.org/html/rfc2606">Reserved Top Level DNS Names</a>,&rdquo; RFC&nbsp;2606.</td></tr>
<tr><td class="author-text" valign="top"><a name="RFC2616">[RFC2616]</a></td>
<td class="author-text">Fielding, R., Gettys, J., Mogul, J., Frystyk, H., Masinter, L., Leach, P., and T. Berners-Lee, &ldquo;<a href="http://tools.ietf.org/html/rfc2616">Hypertext Transfer Protocol -- HTTP/1.1</a>,&rdquo; RFC&nbsp;2616.</td></tr>
<tr><td class="author-text" valign="top"><a name="RFC2818">[RFC2818]</a></td>
<td class="author-text">Rescorla, E., &ldquo;<a href="http://tools.ietf.org/html/rfc2818">HTTP Over TLS</a>,&rdquo; RFC&nbsp;2818, May&nbsp;2000 (<a href="ftp://ftp.isi.edu/in-notes/rfc2818.txt">TXT</a>).</td></tr>
<tr><td class="author-text" valign="top"><a name="RFC3174">[RFC3174]</a></td>
<td class="author-text">Eastlake, D. and P. Jones, &ldquo;<a href="http://tools.ietf.org/html/rfc3174">US Secure Hash Algorithm 1 (SHA1)</a>,&rdquo; RFC&nbsp;3174, September&nbsp;2001 (<a href="ftp://ftp.isi.edu/in-notes/rfc3174.txt">TXT</a>).</td></tr>
<tr><td class="author-text" valign="top"><a name="RFC3986">[RFC3986]</a></td>
<td class="author-text">Berners-Lee, T., &ldquo;<a href="http://tools.ietf.org/html/rfc3986">Uniform Resource Identifiers (URI): Generic Syntax</a>,&rdquo; RFC&nbsp;3986.</td></tr>
<tr><td class="author-text" valign="top"><a name="RFC4287">[RFC4287]</a></td>
<td class="author-text">Nottingham, M., Ed. and R. Sayre, Ed., &ldquo;<a href="http://tools.ietf.org/html/rfc4287">The Atom Syndication Format</a>,&rdquo; RFC&nbsp;4287 (<a href="http://xml.resource.org/public/rfc/html/rfc4287.html">HTML</a>).</td></tr>
<tr><td class="author-text" valign="top"><a name="RSS20">[RSS20]</a></td>
<td class="author-text">Winer, D., &ldquo;<a href="http://www.rssboard.org/rss-specification">RSS 2.0</a>.&rdquo;</td></tr>
<tr><td class="author-text" valign="top"><a name="W3C.REC-html401-19991224">[W3C.REC-html401-19991224]</a></td>
<td class="author-text">Raggett, D., Hors, A., and I. Jacobs, &ldquo;<a href="http://www.w3.org/TR/1999/REC-html401-19991224">HTML 4.01 Specification</a>,&rdquo; World Wide Web Consortium Recommendation&nbsp;REC-html401-19991224, December&nbsp;1999 (<a href="http://www.w3.org/TR/1999/REC-html401-19991224">HTML</a>).</td></tr>
<tr><td class="author-text" valign="top"><a name="XEP-0060">[XEP-0060]</a></td>
<td class="author-text">Millard, P., Saint-Andre, P., and R. Meijer, &ldquo;<a href="http://www.xmpp.org/extensions/xep-0060.html">Publish-Subscribe</a>,&rdquo; XSF XEP&nbsp;0060.</td></tr>
</table>

<a name="anchor11"></a><br /><hr />
<table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc">&nbsp;TOC&nbsp;</a></td></tr></table>
<a name="rfc.section.A"></a><h3>Appendix A.&nbsp;
Specification Feedback</h3>

<p>Feedback on this specification is welcomed via the
      pubsubhubbub mailing list, pubsubhubbub@googlegroups.com.  For
      more information, see <a href='http://groups.google.com/group/pubsubhubbub'>the
      PubSubHubbub group on Google Groups</a>.  Also, check out the
      <a href='http://moderator.appspot.com/#15/e=43e1a&t=426ac'>FAQ</a>
      and <a href='http://code.google.com/p/pubsubhubbub/'>other
      documentation</a>.
      
</p>
<a name="rfc.authors"></a><br /><hr />
<table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc">&nbsp;TOC&nbsp;</a></td></tr></table>
<h3>Authors' Addresses</h3>
<table width="99%" border="0" cellpadding="0" cellspacing="0">
<tr><td class="author-text">&nbsp;</td>
<td class="author-text">Brad Fitzpatrick</td></tr>
<tr><td class="author-text">&nbsp;</td>
<td class="author-text">Google, Inc</td></tr>
<tr><td class="author" align="right">Email:&nbsp;</td>
<td class="author-text"><a href="mailto:brad@danga.com">brad@danga.com</a></td></tr>
<tr cellpadding="3"><td>&nbsp;</td><td>&nbsp;</td></tr>
<tr><td class="author-text">&nbsp;</td>
<td class="author-text">Brett Slatkin</td></tr>
<tr><td class="author-text">&nbsp;</td>
<td class="author-text">Google, Inc</td></tr>
<tr><td class="author" align="right">Email:&nbsp;</td>
<td class="author-text"><a href="mailto:bslatkin@gmail.com">bslatkin@gmail.com</a></td></tr>
<tr cellpadding="3"><td>&nbsp;</td><td>&nbsp;</td></tr>
<tr><td class="author-text">&nbsp;</td>
<td class="author-text">Martin Atkins</td></tr>
<tr><td class="author-text">&nbsp;</td>
<td class="author-text">Six Apart Ltd.</td></tr>
<tr><td class="author" align="right">Email:&nbsp;</td>
<td class="author-text"><a href="mailto:mart@degeneration.co.uk">mart@degeneration.co.uk</a></td></tr>
</table>
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-7156573-1");
pageTracker._trackPageview();
} catch(err) {}</script>
</body></html>
